/*
Copyright (c) [2019年5月1日] [吴超]
[MBT_Studio] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
		 http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
#include "拖放数据创建节点.h"

#include "../ui节点视口.h"

#include "节点类型构建/构建视频图像节点.h"



bool on_文件拖放_节点创建回调(C_Widget* self, const std::vector<std::string>& name, E_对话框类型 方式) {
	static f_节点面板构建_回调函数指针 fun_节点视口回调 = nullptr;

	vec2 pos = f_widget_get鼠标局部位置(C_Widget::g_鼠标.gPos, self);
	f_NodeView_设置节点面板局部添加位置(pos, false);
	//f_NodeView_设置节点面板局部添加位置(C_Widget::g_鼠标.gPos, false);
	//S_框架::g节点创建初始位置 = f_widget_get鼠标局部位置(C_Widget::g_鼠标.gPos, self);
	for (auto& e : name) {
		C_节点面板* panel = nullptr;

		auto 后缀 = f_file_文件扩展名(e);
		if (后缀 == ".png" || 后缀 == ".jpg" || 后缀 == ".tga" || 后缀 == ".hdr" || 后缀 == ".gif") {
			fun_节点视口回调 = C_节点面板::g节点面板构建函数[DEF_外部纹理节点];
			panel = fun_节点视口回调(*self->m_UIctx, *S_框架::g_3D视口环境, nullptr, nullptr);

			f_节点构建_设置外部文件节点参数(panel, e);
		}

		if (panel) {
			f_NodeView_添加节点面板到视口((C_节点视口*)self, panel, true);
			f_NodePlane_鼠标设置节点坐标(panel, S_框架::g节点创建初始位置);
		}
	}
	return true;
}









